var mysql = require('mysql');
var connection = mysql.createConnection({
    host: 'www.svwest.com',
    user: 'root',
    password: '123456',
    database: 'cxy',
    charset: 'utf8_general_ci',
});
connection.connect(function (err) {
    if (err) {
        console.log(err)
        throw err;
    }
    console.log('database connection success');
    console.log('----------------------------');
});


let dbconfig ={
    client: 'mysql',
    connection: {
        host: 'www.svwest.com',
        user: 'root',
        password: '123456',
        database: 'cxy',
        charset: 'utf8_general_ci', //<==指定编码
        port: 3306
    }
}

let knex = require('knex')(dbconfig);

module.exports = knex;

// module.exports = connection;